using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Rocuna.Core
{
    /// <summary>
    /// Vertex type for Position normal.
    /// </summary>
    public class VertexPositionNormal : IVertexType
    {
        #region Constructor

        /// <summary>
        /// Initializes a new instance of the <see cref="VertexPositionNormal"/> class.
        /// </summary>
        /// <param name="position">The position.</param>
        /// <param name="normal">The normal.</param>
        public VertexPositionNormal(Vector3 position, Vector3 normal)
        {
            Position = position;
            Normal = normal;
        }

        #endregion

        #region Fields

        /// <summary>
        /// The position vector.
        /// </summary>
        public Vector3 Position;

        /// <summary>
        /// The normal vector.
        /// </summary>
        public Vector3 Normal;

        #endregion

        #region Implementation of IVertexType

        /// <summary>
        /// Vertex declaration, which defines per-vertex data.
        /// </summary>
        public static readonly VertexDeclaration VertexDeclaration = new VertexDeclaration(
            new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0),
            new VertexElement(12, VertexElementFormat.Vector3, VertexElementUsage.Normal, 0)
            );

        VertexDeclaration IVertexType.VertexDeclaration
        {
            get { return VertexDeclaration; }
        }

        #endregion
    }
}